package com.situ.studentmanagement.controller;

import com.situ.studentmanagement.dao.AfficheMapper;
import com.situ.studentmanagement.model.Affiche;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;

/**
 * Created by baba on 2016/8/2.
 */
@Controller //表示这个类是一个Controller，于是当请求路径 / 时，这个Contrller的实例被自动创建
@RequestMapping("/affiche") //这个controller对应到路径 /
public class affiche {
    @Autowired
    AfficheMapper afficheMapper;

    @RequestMapping("/open")
    public String register(Model model, HttpSession session,
                           @RequestParam("affiche_id")String affiche_id){

        Affiche affiche=afficheMapper.selectOneById(Integer.parseInt(affiche_id));
        model.addAttribute("affiche",affiche);
        return "affiche";
    }

}
